package com.szeastroc.eureka.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.szeastroc.eureka.service.RibbonService;

@Service
public class RibbonServiceImpl implements RibbonService {

	@Autowired
	private RestTemplate restTemplate;

	@HystrixCommand(fallbackMethod="methodError")
	@Override
	public String sayHi() {		
		return restTemplate.getForObject("http://eureka-client/hi/getServerName", String.class) ;
	}
	
	private String methodError() {
		return "method is error";
	}
	
}
